﻿Const IMAGE_NUMBEROF_DIRECTORY_ENTRIES As Integer =  16

Const IMAGE_SIZEOF_FILE_HEADER As Integer  = 20
Const IMAGE_SIZEOF_NT_OPTIONAL32_HEADER As Integer = 224
Const IMAGE_SIZEOF_NT_OPTIONAL64_HEADER As Integer = 240
Const IMAGE_SIZEOF_SHORT_NAME as Integer = 8

Const IMAGE_DOS_SIGNATURE As Ushort = &h0x5A4D
Const IMAGE_NT_SIGNATURE As UShort = &h0x00004550
Const IMAGE_NT_OPTIONAL_HDR32_MAGIC As UShort = &h0x10b
Const IMAGE_NT_OPTIONAL_HDR64_MAGIC As Ushort = &h0x20b
Const IMAGE_ROM_OPTIONAL_HDR_MAGIC As Ushort = &h0x107

Const IMAGE_FILE_RELOCS_STRIPPED As Ushort = &h0x0001
Const IMAGE_FILE_EXECUTABLE_IMAGE As Ushort = &h0x0002
Const IMAGE_FILE_LINE_NUMS_STRIPPED As Ushort = &h0x0004
Const IMAGE_FILE_LOCAL_SYMS_STRIPPED as Ushort = &h0x0008
Const IMAGE_FILE_AGGRESIVE_WS_TRIM as Ushort = &h0x0010
Const IMAGE_FILE_LARGE_ADDRESS_AWARE as Ushort = &h0x0020
Const IMAGE_FILE_BYTES_REVERSED_LO as Ushort = &h0x0080
Const IMAGE_FILE_32BIT_MACHINE as Ushort = &h0x0100
Const IMAGE_FILE_DEBUG_STRIPPED as Ushort = &h0x0200
Const IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP as Ushort = &h0x0400
Const IMAGE_FILE_NET_RUN_FROM_SWAP as Ushort = &h0x0800
Const IMAGE_FILE_SYSTEM as Ushort = &h0x1000
Const IMAGE_FILE_DLL as Ushort = &h0x2000
Const IMAGE_FILE_UP_SYSTEM_ONLY as Ushort = &h0x4000
Const IMAGE_FILE_BYTES_REVERSED_HI as Ushort = &h0x8000

Const IMAGE_FILE_MACHINE_UNKNOWN As Integer =  0
Const IMAGE_FILE_MACHINE_I386 as Ushort = &h0x014c
Const IMAGE_FILE_MACHINE_R3000 as Ushort = &h0x0162
Const IMAGE_FILE_MACHINE_R4000 as Ushort = &h0x0166
Const IMAGE_FILE_MACHINE_R10000 as Ushort = &h0x0168
Const IMAGE_FILE_MACHINE_WCEMIPSV2 as Ushort = &h0x0169
Const IMAGE_FILE_MACHINE_ALPHA as Ushort = &h0x0184
Const IMAGE_FILE_MACHINE_SH3 as Ushort = &h0x01a2
Const IMAGE_FILE_MACHINE_SH3DSP as Ushort = &h0x01a3
Const IMAGE_FILE_MACHINE_SH3E as Ushort = &h0x01a4
Const IMAGE_FILE_MACHINE_SH4 as Ushort = &h0x01a6
Const IMAGE_FILE_MACHINE_SH5 as Ushort = &h0x01a8
Const IMAGE_FILE_MACHINE_ARM as Ushort = &h0x01c0
Const IMAGE_FILE_MACHINE_ARMV7 as Ushort = &h0x01c4
Const IMAGE_FILE_MACHINE_ARMNT as Ushort = &h0x01c4
Const IMAGE_FILE_MACHINE_ARM64 as Ushort = &h0xaa64
Const IMAGE_FILE_MACHINE_THUMB as Ushort = &h0x01c2
Const IMAGE_FILE_MACHINE_AM33 as Ushort = &h0x01d3
Const IMAGE_FILE_MACHINE_POWERPC as Ushort = &h0x01F0
Const IMAGE_FILE_MACHINE_POWERPCFP as Ushort = &h0x01f1
Const IMAGE_FILE_MACHINE_IA64 as Ushort = &h0x0200
Const IMAGE_FILE_MACHINE_MIPS16 as Ushort = &h0x0266
Const IMAGE_FILE_MACHINE_ALPHA64 as Ushort = &h0x0284
Const IMAGE_FILE_MACHINE_MIPSFPU as Ushort = &h0x0366
Const IMAGE_FILE_MACHINE_MIPSFPU16 as Ushort = &h0x0466
Const IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
Const IMAGE_FILE_MACHINE_TRICORE as Ushort = 0x0520
Const IMAGE_FILE_MACHINE_CEF as Ushort = &h0x0CEF
Const IMAGE_FILE_MACHINE_EBC as Ushort = &h0x0EBC
Const IMAGE_FILE_MACHINE_AMD64 as Ushort = &h0x8664
Const IMAGE_FILE_MACHINE_M32R as Ushort = &h0x9041
Const IMAGE_FILE_MACHINE_CEE as Ushort = &h0xc0ee

Const IMAGE_SUBSYSTEM_UNKNOWN as Integer = 0
Const IMAGE_SUBSYSTEM_NATIVE as Integer = 1
Const IMAGE_SUBSYSTEM_WINDOWS_GUI as Integer = 2
Const IMAGE_SUBSYSTEM_WINDOWS_CUI as Integer = 3
Const IMAGE_SUBSYSTEM_OS2_CUI as Integer = 5
Const IMAGE_SUBSYSTEM_POSIX_CUI as Integer = 7
Const IMAGE_SUBSYSTEM_NATIVE_WINDOWS as Integer = 8
Const IMAGE_SUBSYSTEM_WINDOWS_CE_GUI as Integer = 9
Const IMAGE_SUBSYSTEM_EFI_APPLICATION as Integer = 10
Const IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER as Integer = 11
Const IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER as Integer = 12
Const IMAGE_SUBSYSTEM_EFI_ROM as Integer = 13
Const IMAGE_SUBSYSTEM_XBOX as Integer = 14
Const IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION as Integer = 16

Const IMAGE_SCN_TYPE_NO_PAD as Ushort = &h0x00000008

Const IMAGE_SCN_CNT_CODE as Ushort = &h0x00000020
Const IMAGE_SCN_CNT_INITIALIZED_DATA as Ushort = &h0x00000040
Const IMAGE_SCN_CNT_UNINITIALIZED_DATA as Ushort = &h0x00000080
Const IMAGE_SCN_LNK_OTHER as Ushort = &h0x00000100
Const IMAGE_SCN_LNK_INFO as Ushort = &h0x00000200
Const IMAGE_SCN_LNK_REMOVE as Ushort = &h0x00000800
Const IMAGE_SCN_LNK_COMDAT as Ushort = &h0x00001000
Const IMAGE_SCN_NO_DEFER_SPEC_EXC as Ushort = &h0x00004000
Const IMAGE_SCN_GPREL as Ushort = &h0x00008000
Const IMAGE_SCN_MEM_FARDATA as Ushort = &h0x00008000
Const IMAGE_SCN_MEM_PURGEABLE as Ushort = &h0x00020000
Const IMAGE_SCN_MEM_16BIT as Ushort = &h0x00020000
Const IMAGE_SCN_MEM_LOCKED as Ushort = &h0x00040000
Const IMAGE_SCN_MEM_PRELOAD as Ushort = &h0x00080000
Const IMAGE_SCN_ALIGN_1BYTES as Ushort = &h0x00100000
Const IMAGE_SCN_ALIGN_2BYTES as Ushort = &h0x00200000
Const IMAGE_SCN_ALIGN_4BYTES as Ushort = &h0x00300000
Const IMAGE_SCN_ALIGN_8BYTES as Ushort = &h0x00400000
Const IMAGE_SCN_ALIGN_16BYTES as Ushort = &h0x00500000
Const IMAGE_SCN_ALIGN_32BYTES as Ushort = &h0x00600000
Const IMAGE_SCN_ALIGN_64BYTES as Ushort = &h0x00700000
Const IMAGE_SCN_ALIGN_128BYTES as Ushort = &h0x00800000
Const IMAGE_SCN_ALIGN_256BYTES as Ushort = &h0x00900000
Const IMAGE_SCN_ALIGN_512BYTES as Ushort = &h0x00A00000
Const IMAGE_SCN_ALIGN_1024BYTES as Ushort = &h0x00B00000
Const IMAGE_SCN_ALIGN_2048BYTES as Ushort = &h0x00C00000
Const IMAGE_SCN_ALIGN_4096BYTES as Ushort = &h0x00D00000
Const IMAGE_SCN_ALIGN_8192BYTES as Ushort = &h0x00E00000
Const IMAGE_SCN_ALIGN_MASK as Ushort = &h0x00F00000
Const IMAGE_SCN_LNK_NRELOC_OVFL as Ushort = &h0x01000000
Const IMAGE_SCN_MEM_DISCARDABLE as Ushort = &h0x02000000
Const IMAGE_SCN_MEM_NOT_CACHED as Ushort = &h0x04000000
Const IMAGE_SCN_MEM_NOT_PAGED as Ushort = &h0x08000000
Const IMAGE_SCN_MEM_SHARED as Ushort = &h0x10000000
Const IMAGE_SCN_MEM_EXECUTE as Ushort = &h0x20000000
Const IMAGE_SCN_MEM_READ as Ushort = &h0x40000000
Const IMAGE_SCN_MEM_WRITE as Ushort = &h0x80000000
Const IMAGE_SCN_SCALE_INDEX as Ushort = &h0x00000001

Const IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA as Ushort = &h0x0020
Const IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE as Ushort = &h0x0040
Const IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY as Ushort = &h0x0080
Const IMAGE_DLLCHARACTERISTICS_NX_COMPAT as Ushort = &h0x0100
Const IMAGE_DLLCHARACTERISTICS_NO_ISOLATION as Ushort = &h0x0200
Const IMAGE_DLLCHARACTERISTICS_NO_SEH as Ushort  = &h0x0400
Const IMAGE_DLLCHARACTERISTICS_NO_BIND as Ushort = &h0x0800
Const IMAGE_DLLCHARACTERISTICS_APPCONTAINER as Ushort = &h0x1000
Const IMAGE_DLLCHARACTERISTICS_WDM_DRIVER as Ushort = &h0x2000
Const IMAGE_DLLCHARACTERISTICS_GUARD_CF as Ushort = &h0x4000
Const IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE as Ushort = &h0x8000

Const IMAGE_DIRECTORY_ENTRY_EXPORT As Integer = 0
Const IMAGE_DIRECTORY_ENTRY_IMPORT As Integer = 1
Const IMAGE_DIRECTORY_ENTRY_RESOURCE As Integer = 2
Const IMAGE_DIRECTORY_ENTRY_EXCEPTION As Integer = 3
Const IMAGE_DIRECTORY_ENTRY_SECURITY As Integer =4
Const IMAGE_DIRECTORY_ENTRY_BASERELOC As Integer = 5
Const IMAGE_DIRECTORY_ENTRY_DEBUG As Integer = 6
Const IMAGE_DIRECTORY_ENTRY_ARCHITECTURE As Integer =7
Const IMAGE_DIRECTORY_ENTRY_GLOBALPTR As Integer = 8
Const IMAGE_DIRECTORY_ENTRY_TLS As Integer = 9
Const IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG As Integer = 10
Const IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT As Integer =11
Const IMAGE_DIRECTORY_ENTRY_IAT As Integer = 12
Const IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT As Integer = 13
Const IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR As Integer = 14

Type _IMAGE_DATA_DIRECTORY
   'DWORD VirtualAddress
   'DWORD Size
   a As Integer
End Type
